package com.atguigu.day05.HomeWork;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/4 19:11
 * @注释 随机生成一组验证码
 */
public class HomeWork4 {
    public static void main(String[] args) {
        char[] letters = new char[26*2+10];
        for (int i = 0; i < 26; i++) {
            letters[i] = (char) ('a' + i);
            letters[i+26] = (char) ('A' + i);
        }
        for (int i = 0; i < 10; i++) {
            letters[26*2+i] = (char)('0' + i);
        }
        String s = "";
        for (int i = 0; i < 6; i++) {
            int index = (int)(Math.random()*letters.length);
            s += letters[index];
        }
        System.out.println("随机验证码:" + s);

    }
}
